import Vue from 'vue'
import VueRouter from 'vue-router'
import departentPage from '@/view/departent/departentPage'
import layout from '@/view/layout'
import home from '@/view/home/home'
import departentIndex from '@/view/home/departentIndex'
import selfIndex from '@/view/home/selfIndex'
import person from '@/view/self/person'
import vestin from '@/view/self/vestin'
import selfPage from '@/view/self/selfPage'
import departenName from '@/view/departentResult/departenName'
import departentResult from '@/view/departentResult/departentResult'
import departentDownLo from '@/view/departentResult/departentDownLo'
import selfDownLo from '@/view/selfResult/selfDownLo'
import personList from '@/view/selfResult/personList'
import departenList from '@/view/selfResult/departenList'
import personResult from '@/view/selfResult/personResult'
import personResultList from '@/view/selfResult/personResultList'

import adminPerson from "@/view/admin/adminPerson";
import adminDepartment from "@/view/admin/adminDepartment";
import adminTime from "@/view/admin/adminTime"; 
import adminQuestion from "@/view/admin/adminQuestion"; 


Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path: '/',
      redirect: '/page/home',
    },
    {
      path: '/page', component: layout, children: [
        { name: 'home', path: 'home', component: home },
        { name: 'departentPage', path: '/departentPage', component: departentPage, },
        { name: 'departentIndex', path: '/departentIndex', component: departentIndex, },
        { name: 'selfIndex', path: '/selfIndex', component: selfIndex, },
        {
          path: '/selfPage', component: selfPage, redirect: { name: 'vestin' }, children: [
            { name: 'vestin', path: '/vestin/:vestinId', component: vestin },
            { name: 'person', path: '/person/:personEid/:departmentId', component: person },
          ]
        },
        // 集体结果
        {
          path: '/departenName', component: departenName, redirect: { name: 'departentResult' }, children: [
            { name: 'departentResult', path: '/departentResult', component: departentResult },
          ]
        },
        // 下载 / 查看结果
        { name: 'departentDownLo', path: '/departentDownLo', component: departentDownLo },
        { name: 'personResultList', path: '/personResultList', component: personResultList },
        { name: 'selfDownLo', path: '/selfDownLo', component: selfDownLo },
        // 日常结果
        {
          path: '/departenList', component: departenList, redirect: { name: 'personList' }, children: [
            { name: 'personList', path: '/personList/:depId', component: personList },
            // { name: 'personResult', path: '/personResult/:personEid/:departmentId', component: personResult },
            { name: 'personResult', path: '/personResult', component: personResult }, //编程式导航传参
          ]
        },
        // 后台管理
        { name: 'adminPerson', path: '/adminPerson', component: adminPerson },//人员管理
        { name: 'adminDepartment', path: '/adminDepartment', component: adminDepartment },//部门管理
        { name: 'adminTime', path: '/adminTime', component: adminTime },//时间管理
        { name: 'adminQuestion', path: '/adminQuestion', component: adminQuestion },//题目管理
      ]
    }
  ]
})

export default router